<?php
/**
 * Created by PhpStorm.
 * User: hanbin
 * Date: 17/3/29
 * Time: 下午4:06
 */

namespace App\Http\Controllers\Auth;


use App\Http\Controllers\BaseController;
use App\Logic\AreaLogic;

/**
 * <About>地域</About>
 * Class AreaController
 * @package App\Http\Controllers\Auth
 */
class AreaController extends BaseController
{
    public function __construct()
    {

    }

    /**
     * <document>
     * <name>获取地域列表</name>
     * <author>hanbin</author>
     * <link>/area/list</link>
     * <data>pagesize|每页个数|必须|int,
     * last_id|当前页码|必须|int,p_id|父级ID(1:获取省;其他获取省级以下市区)|必须|int</data>
     * <return>返回值|返回值说明|返回值类型,
     * id|地区ID|必须|int,
     * name|省市区名|必须|string</return>
     *</document>
     */
    public function getList()
    {
        $page = request()->input('pagesize');
        $last_id = request()->input('last_id');
        $p_id = request()->input('p_id');
        $so = [];
        $so['fid'] = $p_id;
        $result = AreaLogic::getList($page, null, $last_id, $so);
        return $this->success($result);
    }
}